﻿using System;
namespace Legend.Threading
{
    /// <summary>
    /// Allows for scheduling of actions.
    /// </summary>
    public interface IScheduler
        : IDisposable
    {
        /// <summary>
        /// Schedules the specified action to be invoked at the time specified.
        /// </summary>
        /// <param name="callback">The action to be invoked.</param>
        /// <param name="callbackTime">The time when to invoke the action.</param>
        /// <remarks>The action will be invoked no earlier than the time specified
        /// but it can not be guaranteed to be invoked at the time specified.</remarks>
        void Schedule(Action callback, DateTime callbackTime);

        /// <summary>
        /// Removes the first occurance of the spcified action scheduled at the 
        /// specified time.
        /// </summary>
        /// <param name="callback">The callback to remove.</param>
        /// <param name="callbackTime">The time the callback is scheduled
        /// for.</param>
        void Remove(Action callback, DateTime callbackTime);
    }
}
